#include<cstdio>
using namespace std;
int n,a[200002],i,f,bj;
int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	scanf("%d",&a[i]);
	do
	{
		bj=0;
		for(i=1;i<=n;i++)
		if(a[i]!=-1)
		{
			printf("%d ",i);
			bj=1;
			break;
		}
		f=a[i];
		a[i]=-1;
		for(;i<=n;i++)
		if(a[i]!=f&&a[i]!=-1)
		{
			f=a[i];
			printf("%d ",i);
			a[i]=-1;
		}
		printf("\n");
	}while(bj==1);
	return 0;
}
